/**
 *
 */
package jp.seraph.jsade.perceptor;

import jp.seraph.jsade.sexpression.Node;

/**
 *
 *
 */
public class HingeJointBuilder implements PerceptorBuilder {

    /**
     *
     * @see jp.seraph.jsade.perceptor.PerceptorBuilder#build(jp.seraph.jsade.sexpression.Node)
     */
    public Perceptor build(Node aNode) {
        String tName = aNode.getValue("n");
        String tAngleStr = aNode.getValue("ax");

        if (tName == null || tAngleStr == null)
            throw new IllegalArgumentException("ノードの構造が想定のものと違います。");

        return new HingeJointPerceptor(tName, Double.parseDouble(tAngleStr));
    }
}
